Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BitPackedArray::scalar_at #160

Merged
merged 20 commits into from
Apr 3, 2024
Merged

BitPackedArray::scalar_at #160

merged 20 commits into from
Apr 3, 2024

Conversation

lwwmanning
Copy link
Member

@lwwmanning lwwmanning commented Mar 27, 2024

No description provided.

@lwwmanning lwwmanning changed the title [wip] FastLanes bitpacking scalar_at BitPackedArray::scalar_at Apr 2, 2024
@lwwmanning lwwmanning marked this pull request as ready for review April 2, 2024 18:53
@lwwmanning lwwmanning enabled auto-merge (squash) April 2, 2024 18:53
@lwwmanning lwwmanning disabled auto-merge April 2, 2024 21:26
@lwwmanning
Copy link
Member Author

lwwmanning commented Apr 2, 2024

depends on #179

gatesn
gatesn previously requested changes Apr 2, 2024
Copy link
Contributor

@gatesn gatesn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should benchmark this. There's quite a lot of logic for 1 scalar and I think there's quite a lot of room to improve performance

fastlanez/src/transpose.rs Outdated Show resolved Hide resolved
fastlanez/src/bitpack.rs Outdated Show resolved Hide resolved
@lwwmanning
Copy link
Member Author

benchmark results at commit e88374f on my MacBook Air M2:

~/g/vortex ❯❯❯ cargo bench --bench bitpacking
   Compiling vortex-fastlanes v0.1.0 (/Users/will/git/vortex/vortex-fastlanes)
    Finished `bench` profile [optimized] target(s) in 1.83s
     Running benches/bitpacking.rs (target/release/deps/bitpacking-274b666c83950221)
Gnuplot not found, using plotters backend
bitpack_1M              time:   [55.673 µs 55.768 µs 55.883 µs]
Found 13 outliers among 100 measurements (13.00%)
  11 (11.00%) high mild
  2 (2.00%) high severe

unpack_1M               time:   [224.61 µs 240.60 µs 258.08 µs]
Found 11 outliers among 100 measurements (11.00%)
  6 (6.00%) high mild
  5 (5.00%) high severe

unpack_1M_singles       time:   [2.2627 ms 2.2864 ms 2.3125 ms]
Found 13 outliers among 100 measurements (13.00%)
  8 (8.00%) high mild
  5 (5.00%) high severe

unpack_1024             time:   [43.631 ns 43.774 ns 43.928 ns]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

unpack_single           time:   [4.9211 ns 4.9358 ns 4.9515 ns]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

@lwwmanning lwwmanning merged commit 221e2fb into develop Apr 3, 2024
2 checks passed
@lwwmanning lwwmanning deleted the wm/bp-scalar-at branch April 3, 2024 19:07
Comment on lines +38 to +49
fn scalar_at(&self, index: usize) -> VortexResult<Scalar> {
if index >= self.len() {
return Err(vortex_err!(OutOfBounds:index, 0, self.len()));
}
if self.bit_width() == 0 {
let ptype = self.dtype().try_into()?;
match_each_integer_ptype!(&ptype, |$P| {
return Ok(Scalar::from(0 as $P));
})
}
unpack_single(self, index)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to take patches into account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants